﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MediaPortal.Profile;
using MediaPortal.Configuration;

namespace UPNP_RendererPlugin
{
    
    public partial class configuration : Form
    {
        public static string renderer_name = "not set";
        public static string renderer_manufacturer = "not set";
        public static string renderer_model = "not set";
        public static string renderer_description = "not set";
        public configuration()
        {
            InitializeComponent();
        }

        private void savButton_Click(object sender, EventArgs e)
        {
            using (Settings reader = new Settings(Config.GetFile(Config.Dir.Config, "mediaportal.xml")))
            {
                renderer_name = this.textBox1.Text;
                renderer_manufacturer = this.textBox2.Text;
                renderer_model = this.textBox3.Text;
                renderer_description = this.textBox4.Text;
                reader.SetValue("upnp_renderer", "renderer_name", renderer_name);
                reader.SetValue("upnp_renderer", "renderer_manufacturer", renderer_manufacturer);
                reader.SetValue("upnp_renderer", "renderer_model", renderer_model);
                reader.SetValue("upnp_renderer", "renderer_description", renderer_description);
            }
            MessageBox.Show("Einstellungen gespeichert!");
            this.Hide();
        }

        private void abbButton_Click(object sender, EventArgs e)
        {
            //configuration().Hide();
            this.Hide();
            //MessageBox.Show("Configuration abgebrochen!");
        }
        internal static void readMPconfig()
        {
            using (Settings reader = new Settings(Config.GetFile(Config.Dir.Config, "mediaportal.xml")))
            {
                
                renderer_name = reader.GetValue("upnp_renderer", "renderer_name");
                renderer_manufacturer = reader.GetValue("upnp_renderer", "renderer_manufacturer");
                renderer_model = reader.GetValue("upnp_renderer", "renderer_model");
                renderer_description = reader.GetValue("upnp_renderer", "renderer_description");
                MessageBox.Show("Einstellungen:" + renderer_name + "\n" + renderer_manufacturer + "\n" + renderer_model + "\n" + renderer_description);
                //MessageBox.Show("");
            }
        }

        private void setupGroup_Enter(object sender, EventArgs e)
        {

        }

    }
}
